package org.javaboy.fmall.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @ClassName Swagger2Config
 * @Description
 * @Author find me
 * @Date 2020/7/16 0016 0:19
 * @Version 1.0
 */
@Configuration
@EnableSwagger2
@EnableKnife4j
@Import(BeanValidatorPluginsConfiguration.class)
public class Swagger2Config {
    @Bean
    Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("PIPENET-CRUD")
                .select()
                //告诉swagger2controller在哪里
                .apis(RequestHandlerSelectors.basePackage("org.javaboy.fmall.controller"))
                .paths(PathSelectors.any())// 这里面的所有路径
                .build().apiInfo(new ApiInfoBuilder()//构建
                        .description("接口文档的描述信息-2354827879")
                        .title("表单系统项目接口文档")
                        // 联系人信息
                        .contact(new Contact("javaboy","http://127.0.0.1:8080/doc.html","2354827879@qq.com"))
                        .version("v1.0")
                        .license("Apache2.0")
                        .build());
    }
}
